<?php 
defined( '_VALID_NVB' ) or die( 'Direct Access to this location is not allowed.' );
$tpl = new TemplatePower("template/loadphoto.htm");
$tpl->prepare();
$tpl->assignGlobal("p",$_REQUEST['p']+1);
$sql="SELECT * FROM photo WHERE active=1 ORDER BY thu_tu DESC, id_photo DESC";
$db=phan_trang($_REQUEST['p'],"?page=loadphoto",$sql,8,1);
if($rs=mysql_fetch_array($db['db'])){
	if ($rs['image'] && file_exists($CONFIG['upload_image_path'].$rs['image'])){
		$size=getimagesize($CONFIG['upload_image_path'].$rs['image']);
		if($size[0]>650){
			$tpl->assign("image","<img width='650' alt='".clean_url($rs['name'])."' src='".$site_address.$CONFIG['upload_image_path'].$rs['image']."'  border='0' >");
		}else{
			$tpl->assign("image","<img  alt='".clean_url($rs['name'])."' src='".$site_address.$CONFIG['upload_image_path'].$rs['image']."'  border='0' >");
		}
	}	
}

$tpl->printToScreen();	
?>